﻿using CMS.DataAccess;
using CMS.Model;

namespace CMS.AOP
{
    public class ScheduleDefValueSetter : IDefaultValueSetter<ScheduleModel>
    {
        public void SetValue(ScheduleModel value)
        {
            var dt = DateTime.Parse(value.Date);
            value.WeekDay = dt.DayOfWeek;
            value.RefWeekDay = dt.DayOfWeek;
            var courseQuery = new DbQuery<CourseModel>();
            var course = courseQuery.Get(value.Course);
            value.Color = course.Color;
            value.Optional = course.Optional;
            value.GroupClass = course.GroupClass; 

        }
    }
}
